package L1;

import java.io.IOException;
import java.util.Scanner;

public class _087 {
    /**
     * 机工士姆斯塔迪奥
     */
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int Q = scanner.nextInt();
        int sum = 0;
        int[][] arr = new int[N][M];
        for (int i = 0; i < Q; i++) {
            int T = scanner.nextInt();
            int C = scanner.nextInt() - 1;
            if (T == 0) {
                for (int j = 0; j < M; j++) {
                    arr[C][j] = 1;
                }
            }
            if (T == 1) {
                for (int j = 0; j < N; j++) {
                    arr[j][C] = 1;
                }
            }
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                if (arr[i][j] == 0) {
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
}
